export const BASE_URL = 'https://letaoapi.jxsaichuang.com/'

export function request(options) {
  // 如果 url 不是以 http/https 开头，则自动拼接 BASE_URL
  if (!/^https?:\/\//.test(options.url)) {
    options.url = BASE_URL + options.url.replace(/^\/+/, '')
  }
  return new Promise((resolve, reject) => {
    uni.request({
      ...options,
      success: resolve,
      fail: reject
    })
  })
}